需要仿照ios时钟界面,android系统中实现,首先分析android系统应用DeskClock
分析方法,首先分析AndroidManifest文件
分析AosDeskClock AndroidManifest.xml文件
<application android:label="@string/app_label"
android:icon="@mipmap/ic_launcher_alarmclock"
android:requiredForAllUsers="true"
android:supportsRtl="true">
application层级 设置了label icon supportsRtl
以及 android:requiredForAllUsers="true"------此句意义不明确
<activity android:name="DeskClock"
android:label="@string/app_label"
android:theme="@style/DeskClock"
android:icon="@mipmap/ic_launcher_alarmclock"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustNothing"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
第一个activity name DeskClock 桌面时钟,与整个application有相同的label,theme 主题风格,应该是设置字体颜色等,icon图标,activity的launchmode singletask,screenOrientation,竖直方向,windowsoftinputmode,此属性用来协调虚拟键盘弹出的显示情况,此属性有待研究
还适配了一个intent-filter action category已经给出,应该是用于外部启动这个activity
<activity-alias android:name="DockClock"
android:targetActivity="DeskClock"
android:label="@string/app_label"
android:theme="@style/DeskClock"
android:icon="@mipmap/ic_launcher_alarmclock"
android:launchMode="singleTask"
android:enabled="@bool/config_dockAppEnabled"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.DESK_DOCK" />
</intent-filter>
</activity-alias>
一个activity-alias层级 activity-alias通过指定targetActivity来决定入口相连接的activity,给该程序更改一个不同的label和icon,两个图标进入同一个activity
<activity android:name="SettingsActivity"
android:label="@string/settings"
android:theme="@style/Theme.Settings"
android:taskAffinity=""
android:excludeFromRecents="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
第二个activity name SettingsActivity 有一个label,theme,taskAffinity空, android:excludeFromRecents控制在不在recent列表中显示。true时不显示;false显示,默认。运行如下activity后,不会显示在recent列表中。依然有意个intent-filter